/**
 * Copyright &copy; 2012-2016 All rights reserved.
 */
package ${basepackage}.app.model;

import javax.persistence.Table;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;

<#list table.importList as i>
import ${i};
</#list>
<#list table.importModelList as i>
import ${basepackage}.app.model.${i};
</#list>
<#list table.importPredefinedModelList as i>
import ${importbasepackage}.app.model.${i};
</#list>
import ${importbasepackage}.framework.base.dao.BaseUpdatableEntity;

/**
 *@auther XiWei
 */
@Entity
@Table(name="${table.tableName}")
@DynamicUpdate(value=true)
@DynamicInsert(value=true)
public class ${ClassName} extends BaseUpdatableEntity{

	private static final long serialVersionUID = 1L;
	
	<#-- 生成字段属性 -->
	<#list table.columnList as c>
	<#if !c.baseField && !c.fk>
	<#list c.annotationList as a>
	${a}
	</#list>
	private ${c.simpleJavaType} ${c.javaField}; <#if c.columnComment??>//${c.columnComment} </#if>
	</#if>
	</#list>
	
	
	<#-- 生成get/set方法 -->
	<#list table.columnList as c>
	<#if !c.baseField && !c.fk>
	public void set${c.javaField?cap_first}(${c.simpleJavaType} ${c.javaField})
	{
		this.${c.javaField} = ${c.javaField};
	}
	public ${c.simpleJavaType} get${c.javaField?cap_first}()
	{
		return ${c.javaField};
	}
	
	</#if>
	</#list>
	
	<#--生成 ManyToOne字段 -->
	<#list table.importedKeyList as key>
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "${key.columnName}") })
	private ${key.referencedTableJavaField?cap_first} ${key.columnNameJavaField};
	
	public void set${key.columnNameJavaField?cap_first}(${key.referencedTableJavaField?cap_first} ${key.columnNameJavaField})
	{
		this.${key.columnNameJavaField} = ${key.columnNameJavaField};
	}
	public ${key.referencedTableJavaField?cap_first} get${key.columnNameJavaField?cap_first}()
	{
		return ${key.columnNameJavaField};
	}
	</#list>
	
}